package org.example.mapper;

/**
 * @author by PengHongChao
 * @date 2025/6/23 15:43
 */

import org.apache.ibatis.annotations.*;
import org.example.model.SyncConfig;
import org.example.model.SyncConfigQuery;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 同步配置Mapper接口
 */
@Mapper
public interface SyncConfigMapper {

    void insert(SyncConfig config);
    void update(SyncConfig config);
    SyncConfig selectById(Long id);
    List<SyncConfig> selectAllEnabled();
    SyncConfig selectByTableName(String tableName);
    void deleteById(Long id);
    void updateLastSyncTime(@Param("id") Long id, @Param("syncTime") LocalDateTime syncTime);
    void updateSyncStatus(@Param("id") Long id,
                          @Param("successTime") LocalDateTime successTime,
                          @Param("errorCount") Integer errorCount);

    // 新增方法
    List<SyncConfig> selectByCondition(SyncConfigQuery query);
    long countByCondition(SyncConfigQuery query);

}
